package com.hz.erp.enums.temperature;

import java.math.BigDecimal;
import java.util.HashMap;
import java.util.Map;

/**
 * @author 柯鑫
 * @ClassName com.hz.erp.enums.temperature.TemperatureEnum
 * @description 温度类型枚举类
 * @create 2020年06月08日 18:15
 */
public enum TemperatureEnum {

    normal_tmp("0", "正常"),
    high_tmp("1", "偏高"),
    low_tmp("2", "偏低");

    private String code;
    private String desc;


    TemperatureEnum(String code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    public static String setCodeGetDesc(String code){
        for(TemperatureEnum value : TemperatureEnum.values() ){
            if(value.getCode().equals(code)){
                return value.getDesc();
            }
        }

        return null;
    }

    public static String setDescGetCode(String desc){
        for(TemperatureEnum value : TemperatureEnum.values()){
            if(value.getDesc().equals(desc)){
                return value.getCode();
            }
        }
        return null;
    }

    public static Map<String, String> getAllKeyAndValue(){
        Map<String, String> hashMap = new HashMap<>();
        for(TemperatureEnum value : TemperatureEnum.values()){
            hashMap.put(value.code, value.desc);
        }
        return hashMap;
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getDesc() {
        return desc;
    }

    public void setDesc(String desc) {
        this.desc = desc;
    }

}
